TARGET= ../lib/liblarsclient.a
CXX=g++
CFLAGS=-g -O2 -Wall -Wno-deprecated

BASE=../../../base
BASE_H=$(BASE)/include

PROTO=$(BASE)/proto
PROTO_H=$(PROTO)

LARS_REACTOR=../../../lars_reactor
LARS_REACTOR_H =$(LARS_REACTOR)/include
LARS_REACTOR_LIB=$(LARS_REACTOR)/lib  -lreactor


OTHER_LIB = -lpthread -lprotobuf
SRC= ./
INC= -I./ -I$(BASE_H) -I$(LARS_REACTOR_H) -I$(PROTO_H)

LIB= -L$(LARS_REACTOR_LIB) $(OTHER_LIB)

OBJS = $(addsuffix .o, $(basename $(wildcard $(SRC)/*.cpp)))
OBJS += $(PROTO)/lars.pb.o

$(TARGET): $(OBJS)
	mkdir -p ../lib
	ar cqs $@ $^

%.o: %.cpp
	$(CXX) $(CFLAGS) -o $@ -c $< $(INC) 

.PHONY: clean clean2

clean:
	-rm -f ./*.o $(TARGET) $(PROTO)/*.o
	
clean2:
	-rm -f ./*.o $(PROTO)/*.o